/**
 * 季度绩效目标
 */
import React from 'react';
import { Typography, Form, Tag } from 'antd';
import { FormLayout } from '../../components';

const TAG_MAP = {
    0: <Tag color="red">不合格</Tag>,
    1: <Tag color="green">合格</Tag>
};

export default function AssessKPI({ data = {} }) {
    const { performanceTarget = {} } = data;
    const { result, score, level, summarize, performanceDate } = performanceTarget;

    return (
        <div>
            <FormLayout type="full">
                <Typography.Paragraph>
                    {performanceDate && `该员工 ${performanceDate} 季度的绩效结果如下：`}
                </Typography.Paragraph>
            </FormLayout>

            <div style={{ width: 900 }}>
                <FormLayout type="full">
                    <Form.Item label="绩效指标考核结果">{TAG_MAP[result] ? TAG_MAP[result] : '-'}</Form.Item>
                </FormLayout>

                <FormLayout type="col2">
                    <Form.Item label="绩效得分/等级">{score && level ? `${score} 分 / ${level}` : '-'}</Form.Item>
                </FormLayout>

                <FormLayout type="full">
                    <Form.Item label="绩效总结">{summarize}</Form.Item>
                </FormLayout>
            </div>
        </div>
    );
}
